# coding = utf-8
from django.urls import path
from rest_framework.routers import DefaultRouter

from wxchat.api.wechat_views import getWeChatAuthCode, getWeChatAuth, wechat, getJsApiSign, \
    WxRechargeViewSet, WeChatUserViewSet, get_user_info, WxRechargeRecordViewSet, WxRechargeStatsAPIView
from .views import QrCodeAPIView, SwipeImageViewSet, UserRoleViewSet, QrCodeWithBgAPIView, WxUserInfoViewSet, \
    WxMenuAPIView, WxSwipeImageViewSet, SwipeImageUploadAPIView, QrCodeWithLogoAPIView, \
    RechargeListViewSet, RechargeRecordViewSet, OrderPayView, PayNotify, RechargeStatsAPIView, \
    WxUnifiedOrderResultViewSet, WxPayResultViewSet

router = DefaultRouter()
router.register(r'swipe', SwipeImageViewSet, basename="swipe")
router.register(r'swipe_image', WxSwipeImageViewSet, basename="swipe-image")
router.register(r'role', UserRoleViewSet, basename="role")
router.register(r'wxuser', WxUserInfoViewSet, basename="wechat-user")
router.register(r'recharge_list', RechargeListViewSet, basename="recharge-list")
router.register(r'recharge_record', RechargeRecordViewSet, basename="recharge-record")
router.register(r'unified_order', WxUnifiedOrderResultViewSet, basename="unified-order")
router.register(r'pay_result', WxPayResultViewSet, basename="pay-result")
# 微信
router.register(r'wx_recharge_list', WxRechargeViewSet, basename="wx-recharge-list")
router.register(r'wechat_user', WeChatUserViewSet, basename="wechat-user")
router.register(r'wx_recharge_record', WxRechargeRecordViewSet, basename="wechat-recharge-record")

urlpatterns = [
    path('', wechat),  # 微信入口
    path('menu/', WxMenuAPIView.as_view(), name='wechat-menu'),
    path('auth_code/', getWeChatAuthCode, name='wxchat-auth-code'),
    path('auth_openid/', getWeChatAuth, name='wxchat-auth-openid'),
    path('userinfo/', get_user_info, name='wxchat-user-info'),
    path('jsapi_sign/', getJsApiSign, name='wxchat-jsapi-sign'),
    path('qrcode/', QrCodeAPIView.as_view(), name="qr-code"),
    path('qrcodelogo/', QrCodeWithLogoAPIView.as_view(), name="qr-code-logo"),
    path('qrbgcode/', QrCodeWithBgAPIView.as_view(), name="qr-code-bg"),
    path('swipe_image_upload/', SwipeImageUploadAPIView.as_view(), name='swipe-image-upload'),
    path('pay/', OrderPayView.as_view(),  name="wxchat-order-pay"),  # 支付
    path('pay/notify/', PayNotify.as_view(),  name="order-pay-notify"),  # 支付回调
    path('wx_recharge_stats/', WxRechargeStatsAPIView.as_view(), name="api-wx-recharge-stats"),
    path('recharge_stats/', RechargeStatsAPIView.as_view(), name="api-recharge-stats"),

]

urlpatterns += router.urls
